package edu.jd.homeworkstudent;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface HomeworkStuDao {

    @Select("select tea_name, tea_feedback, hk_title, hk_req,  correct_state, submit_state, score, homework_tea.hk_id " +
            "from homework_stu, teacher, homework_tea " +
            "where homework_stu.stu_id = #{stu_id} " +
            "and homework_stu.hk_id = homework_tea.hk_id " +
            "and homework_tea.tea_id = teacher.tea_id")
    public List<HomeworkStuDto> getStuHomework(String stu_id);

    @Update("update homework_stu set hk_submit = #{hk_submit}, submit_state = true " +
            "where hk_id =  #{hk_id} and stu_id = #{stu_id}")
    public void updateHomework(@Param("hk_id") Integer hk_id, @Param("stu_id") String stu_id, @Param("hk_submit") String hk_submit);

}
